<?php

include_once($GLOBALS['cfgPaths']['lib/dba'].'dbaOrder.o.inc.php');
include_once($GLOBALS['cfgPaths']['lib'].'model2/ActionForm.o.inc.php');
include_once($GLOBALS['MODEL2_BASEDIR'].'model/OrderModel.o.inc.php');
include_once($GLOBALS['MODEL2_BASEDIR'].'langres/login_res.inc.php');

class OrderFinishAction extends WebAction
{

    function execute($env)
    {
        $dbao = new dbaOrder($GLOBALS['udba']);
        $af = new ActionForm();
        $dbao->addOrderCMS($env->getSession('cust'), $env->getSession('s_cart'));
        $om = OrderModel::getInstance();
        $om->sendMails();
        $env->setSession('cust',    null);
        $env->setSession('s_cart',  null);
        $this->copyResources($af, 'order_finished', array('finished_text'));
        $this->forward('order/finishView', $af);
    }

}

?>